package com.ruoyi.hr.controller.hr.salaryadmin.salarydatachange;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.hr.domain.Authority;
import com.ruoyi.hr.service.AuthorityService;
import com.ruoyi.hr.service.salaryadmin.salarydatechange.SalaryDateChangeService;
import com.ruoyi.hr.util.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 止薪日期修改
 */
@Controller
@RequestMapping("/salaryDateChange/salaryDateChange")
public class SalaryDataChangeController extends BaseController {

    @Autowired
    SalaryDateChangeService salaryDateChangeService;

    @Autowired
    AuthorityService authorityService;

    private String prefix = "hr/salaryadmin/salarydatechange";

    /**
     * 跳转初始化页面
     */
    @GetMapping()
    public String salaryDataChange() {
        return prefix + "/salaryDateChange";
    }

    @RequestMapping("/list")
    @ResponseBody
    public TableDataInfo list(@RequestParam Map map) {
        Authority authority = authorityService.findAuthorAndIsAdmin();
        return getDataTable(salaryDateChangeService.findData(map, authority));
    }

    /**
     * 添加员工存储过程
     */
    @PostMapping("/updateProcedure")
    @ResponseBody
    public BaseResult updateProcedure(String allPeid, String EDdate) {
        return salaryDateChangeService.updateProcedure(allPeid, EDdate);
    }
}
